import 'package:aidw_ui/route_get.dart';
import 'package:aidw_ui/string_res/str_res.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'dart:ui' as ui;

import 'app_theme.dart';

void main() {
  /// 设置自动大小的基准
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        designSize: Size(375, 812),
        builder: ()=> RefreshConfiguration(
          headerBuilder: () => ClassicHeader(),
          footerBuilder: () => ClassicFooter(),
          hideFooterWhenNotFull: true,
          headerTriggerDistance: 80,
          maxOverScrollExtent: 100,
          footerTriggerDistance: 150,
          child: GetMaterialApp(
            title: 'AIDW Kit',
            /// 多语言相关
            translations: StringRes(),
            // 默认语言，更改语言：Get.updateLocale(const Locale('en', 'US'));
            locale: ui.window.locale,
            // 如没有，则用该语言
            fallbackLocale: const Locale('en', 'US'),
            /// 路由相关
            initialRoute: RouteGet.homePage,
            getPages: RouteGet.getPages,
            /// 主题相关
            theme: AppTheme.appTheme.themeData().copyWith(platform: TargetPlatform.iOS),
            /// 主页
            //home: const MyHomePage(title: 'Flutter Demo Home Page'),
          ),
        ),
    );
  }
}